<!DOCTYPE html>
<html>
<head>
  <include file="public:header"/>
  <ytata:bbsview listname="bbs" id="$_GET['id']"/>
  <title>{$bbs.content}</title>
  <link rel="stylesheet" href="__PUBLIC__/css/show.css">
</head>

<body>
{:TOP_BACK($bbs['content'])}

<!-- 楼主 -->
<div class="bbsshow noborder">
  <gt name="bbs.count_praise" value="0">
    <div id="J_praise3_{$bbs.id}" class="zan font12 J_praise" data-id="{$bbs.id}" data-type="3">{$bbs.count_praise}</div>
    <else/>
    <div id="J_praise3_{$bbs.id}" class="zan font12 J_praise" data-id="{$bbs.id}" data-type="3">点赞</div>
  </gt>
  
  <div class="uinfo">
    <div class="more J_more_bbs" data-id="{$bbs.id}"></div>
    <div class="avatar"><img src="{$bbs.adduser.avatar}"></div>
    
    <div class="txt">
      <div class="t font14">{$bbs.adduser.nickname}<span class="lv font9">LV{$bbs.adduser.exp_lv}</span></div>
      <div class="date font10">楼主<span>|</span>{$bbs.addtime|formatdate}<span>|</span>浏览:{$bbs.click|default='0'}
      </div>
    </div>
  </div>
  <div class="tag font10">
    <volist name="bbs.tags" id="tag">
      <div class="tagli">{$tag.tag}</div>
    </volist>
  </div>
  <div class="ctxt font16">{$bbs.content}</div>
  
  
  <div class="imgs">
    <volist name="bbs.imgs" id="img">
      <div class="imgli J_imgs"><img src="{$img.imgurl}"></div>
    </volist>
  </div>
  
  
  <div class="replybtn J_reply">回帖</div>

</div>
<!-- 楼主结束 -->
<div class="uu_spacing"></div>
<!--回帖 -->
<ytata:bbsreply listname="replys" bid="$bbs['id']"/>
<empty name="replys.list">
  <div class="empty font12">目前还没人回帖，速抢沙发吧！</div>  <!-- 空数提示 -->
</empty>
<volist name="replys.list" id="reply">
  <div class="bbsshow">
    <neq name="reply.praise" value="0">
      <div id="J_praise4_{$reply.id}" class="zan font12 J_praise" data-id="{$reply.id}" data-type="4">{$reply.praise}</div>
      <else/>
      <div id="J_praise4_{$reply.id}" class="zan font12 J_praise" data-id="{$reply.id}" data-type="4">点赞</div>
    </neq>
    <div class="uinfo">
      <div class="more J_more_reply" data-id="{$reply.id}"></div>
      <div class="avatar"><img src="{$reply.adduser.avatar}"></div>
      
      <div class="txt">
        <div class="t font14">{$reply.adduser.nickname}<span class="lv font9">LV{$reply.adduser.exp_lv}</span></div>
        <div class="date font10">{$reply.floor}楼<span>|</span>{$reply.addtime|formatdate}
        </div>
      </div>
    </div>
    
    <div class="ctxt pleft font16 J_replychat" data-rid="{$reply.id}" data-to_uid="{$reply.adduser.uid}" reply_nickname="{$reply.adduser.nickname}">{$reply.content}</div>
    
    <ytata:bbschat listname="chat" rid="$reply['id']"/>
    <notempty name="chat.list">
      <div class="reply font12">
        <volist name="chat.list" id="chat">
          <div class="rlis J_replychat" data-rid="{$reply.id}" data-to_uid="{$chat.senduser.uid}" reply_nickname="{$chat.senduser.nickname}">
            <div class="trs"><span>{$chat.senduser.nickname}</span>回复 <span>{$chat.touser.nickname}</span></div>
            <div class="txs">{$chat.content}<span class="font10">{$chat.addtime|formatdate}</span></div>
          </div>
        </volist>
      
      </div>
    </notempty>
  
  </div>
</volist>

<include file="public:foot"/>
<include file="public:photoswipe"/>

<script>
  $(function () {
      // 主题更多操作
      $('.J_more_bbs').off().on('click',function(e){
          var objid = $(this).data('id');
          var $Scroll = new UpScroll({
              maskClose: true,
              showCancel: true
          });
          $Scroll.setContent(['关注','收藏','举报']);
          $Scroll.show();
          // 关注
          $Scroll.getList(1).on('click', function() {
              ajax_login('ajax_follow', {objid: objid, type:2});
              $Scroll.fast_hide();
          });
          // 收藏
          $Scroll.getList(2).on('click', function() {
              ajax_login('ajax_favorites', {id: objid, type:3});
              $Scroll.fast_hide();
          });
          // 举报
          $Scroll.getList(3).on('click', function() {
              var params = {objid: objid, type: '3'};
              ajax_login('ajax_report', params);
              $Scroll.fast_hide();
          });

      });

      // 主题回复更多操作
      $('.J_more_reply').off().on('click',function(e){
          var objid = $(this).data('id');
          var $Scroll = new UpScroll({
              maskClose: true,
              showCancel: true
          });
          $Scroll.setContent(['举报']);
          $Scroll.show();
          // 举报
          $Scroll.getList(1).on('click', function() {
              var params = {objid: objid, type: '4'};
              ajax_login('ajax_report', params);
              $Scroll.fast_hide();
          });

      });
      
      // 回帖追加
      $(".J_replychat").click(function (e) {
          var rid = $(this).data('rid');
          var to_uid = $(this).data('to_uid');
          var reply_nickname = $(this).attr('reply_nickname');
          var params = {rid: rid, to_uid: to_uid,reply_nickname:reply_nickname};
          ajax_login('ajax_bbs_chat', params);
      });

      // 回帖
      $(".J_reply").off().on('click', function () {
          var bid = "{$_GET['id']}";
          var reply_nickname = "{$bbs.adduser.nickname}";
          var params = {bid: bid,reply_nickname:reply_nickname};
          ajax_login('ajax_bbs_reply', params);
      });
  });
  
  // 回帖追加
  function ajax_bbs_chat(params) {
      var ajax_addbbs_url = '{:U("ajax_bbs_reply_supp")}';
      $.getJSON(ajax_addbbs_url, params, function (result) {
          if (result.code == 1) {
              show_form('回复',result.data);
              $('.uu_forms').addClass('uu-actionsheet-toggle');
          } else if (result.code == 0) {
              toast(result.msg);
          }
      });
  }

  // 点赞
  $(".J_praise").off().on('click', function () {
      var id = $(this).data('id');
      var type = $(this).data('type');
      var params = {id: id, type: type};
      ajax_login('praise', params);
  });
</script>

</body>

</html>